#include "wuForegroundSkinManager.h"

wuForegroundSkinManager::wuForegroundSkinManager()
{
}

wuForegroundSkinManager::~wuForegroundSkinManager()
{
}

void wuForegroundSkinManager::setup(int _vw, int _vh)
{
    wuBaseManager::setup(_vw,_vh);
    vPriority = 10;
}
bool wuForegroundSkinManager::capture(ofImage *currImg, ofImage *bgImg, int x_offset)
{
	bool bCambiazo = false;

	if(!bBypass)
	{
		skins.clear();

		wuBaseManager::capture(currImg, bgImg, x_offset);
	}
	return bCambiazo;
}

void wuForegroundSkinManager::addBitxo(ofImage *_skin, ofRectangle rect, vector <ofPoint> * _pts)
{
	wuSkin skin;
	skin.setup(_skin, rect);
	skins.push_back(skin);
}

void wuForegroundSkinManager::draw(bool pinta_bg, int offX)
{
	if(!bBypass)
	{
        for (int i = 0; i < skins.size(); i++)
        {
            // TODO
            if(bScrollable)
                skins[i].draw(offX);
            else
                skins[i].draw(offX-x_scroll);
        }

	}
}

void wuForegroundSkinManager::drawSelected(bool pinta_bg, int offX)
{
    if(selection.width == vw && selection.height == vh && !bBypass)
    {
        for (int i = 0; i < skins.size(); i++)
        {
            if(bScrollable)
                skins[i].draw(offX);
            else
                skins[i].draw(0);
        }

	}
}

void wuForegroundSkinManager::clear()
{
    if(selection.width == vw && selection.height == vh)
    {
        skins.clear();
    }
}
